package stub.datasvStub;

import po.CollegeConsularListPO;
import po.CollegeConsularPO;
import po.CollegeCoursePO;
import po.CollegeListPO;
import po.CollegeMemberPO;
import po.StudentPO;
import po.TeacherPO;
import resultmessage.CollegeQueryRM;
import datasv.collegeQuery_datasv.CollegeQueryDatasv;

public class CollegeQueryDatasvStub implements CollegeQueryDatasv{
	CollegeListPO collegeListPO;
	CollegeMemberPO collegeMemberPO;
	CollegeCoursePO collegeCoursePO;
	CollegeConsularListPO collegeConsularListPO;
	
	public CollegeQueryDatasvStub(CollegeListPO collegeListPO, CollegeMemberPO collegeMemberPO,
			CollegeCoursePO collegeCoursePO, CollegeConsularListPO collegeConsularListPO){
		collegeListPO = this.collegeListPO;
		collegeMemberPO = this.collegeMemberPO;
		collegeCoursePO = this.collegeCoursePO;
		collegeConsularListPO = this.collegeConsularListPO;
	}
	
	@Override
	public CollegeListPO getCollegeList() {
		// TODO Auto-generated method stub
		return collegeListPO;
	}

	@Override
	public CollegeMemberPO getCollege(String collegeID, MemberType memberType) {
		// TODO Auto-generated method stub
		if(collegeMemberPO.getCollegeID().equals(collegeID)
				&&collegeMemberPO.getMemberType().equals(memberType)){
			return collegeMemberPO;
		}
		return null;
	}
//
//	@Override
//	public CollegeQueryRM addTeacher(String collegeID, MemberType memberType,
//			String teacherID) {
//		// TODO Auto-generated method stub
//		
//	}

//	@Override
//	public CollegeQueryRM deleteTeacher(String collegeID, MemberType memberType,
//			String teacherID) {
//		// TODO Auto-generated method stub
//		if(collegeID.equalsIgnoreCase(collegeMemberPO.getCollegeID())
//				&&memberType.equals(collegeMemberPO.getMemberType())){
//			for(String m1:collegeMemberPO.getMemberIDList()){
//				if(m1.equals(teacherID)){
//					return CollegeQueryRM.SUCCESS;
//				}
//			}
//			return CollegeQueryRM.TEACHERID_EXIST;
//		}
//		return CollegeQueryRM.COLLEGE_NOT_EXIT;
//	}

//	@Override
//	public CollegeQueryRM addStudent(String collegeID, MemberType memberType,
//			String studentID) {
//		// TODO Auto-generated method stub
//		if(collegeID.equalsIgnoreCase(collegeMemberPO.getCollegeID())
//				&&memberType.equals(collegeMemberPO.getMemberType())){
//			for(String m1:collegeMemberPO.getMemberIDList()){
//				if(m1.equals(studentID)){
//					return CollegeQueryRM.STUDENT_EXIST;
//				}
//			}
//			return CollegeQueryRM.SUCCESS;
//		}
//		return CollegeQueryRM.COLLEGE_NOT_EXIT;
//	}

//	@Override
//	public CollegeQueryRM deleteStudent(String collegeID, String studentID) {
//		// TODO Auto-generated method stub
//		if(collegeID.equalsIgnoreCase(collegeMemberPO.getCollegeID())
//				&&memberType.equals(collegeMemberPO.getMemberType())){
//			for(String m1:collegeMemberPO.getMemberIDList()){
//				if(m1.equals(studentID)){
//					return CollegeQueryRM.SUCCESS;
//				}
//			}
//			return CollegeQueryRM.STUDENT_NOT_EXIST;
//		}
//		return CollegeQueryRM.COLLEGE_NOT_EXIT;
//	}

//	@Override
//	public CollegeQueryRM addCourse(String collegeID, String courseID) {
//		// TODO Auto-generated method stub
//		if(collegeID.equals(collegeCoursePO.getCollegeID())){
//			for(String c1: collegeCoursePO.courseIDList()){
//				if(c1.equals(courseID)){
//					return CollegeQueryRM.COURSEID_EXIST;
//				}
//			}
//			return CollegeQueryRM.SUCCESS;
//		}
//		return CollegeQueryRM.COLLEGE_NOT_EXIT;
//	}

	@Override
	public CollegeQueryRM deleteCourse(String collegeID, String courseID) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeCoursePO.getCollegeID())){
			for(String c1: collegeCoursePO.courseIDList()){
				if(c1.equals(courseID)){
					return CollegeQueryRM.SUCCESS;
				}
			}
			return CollegeQueryRM.COURSEID_NOT_EXIST;
		}
		return CollegeQueryRM.COLLEGE_NOT_EXIT;
	}

	@Override
	public CollegeQueryRM addCollegeConsular(String collegeID, CollegeConsularPO po) {
		// TODO Auto-generated method stub
		if(collegeID.equals(collegeConsularListPO.getCollegeID())){
			for(CollegeConsularPO p1:collegeConsularListPO.getCollegeConsularList()){
				if(p1.equals(po)){
					return CollegeQueryRM.COLLEGECONSULAR_EXIT;
				}
			}
			return CollegeQueryRM.SUCCESS;
		}
		return CollegeQueryRM.COLLEGE_NOT_EXIT;
	}

//	@Override
//	public CollegeQueryRM deleteCollegeConsular(String collegeID, CollegeConsularPO po) {
//		// TODO Auto-generated method stub
//		if(collegeID.equals(collegeConsularListPO.getCollegeID())){
//			for(CollegeConsularPO p1:collegeConsularListPO.getCollegeConsularList()){
//				if(p1.equals(po)){
//					return CollegeQueryRM.SUCCESS;
//				}
//			}
//			return CollegeQueryRM.COLLEGECONSULAR_NOT_EXIT;
//		}
//		return CollegeQueryRM.COLLEGE_NOT_EXIT;
//	}

	@Override
	public CollegeQueryRM addTeacher(String collegeID, TeacherPO po,
			String teacherID) {
		if(collegeID.equalsIgnoreCase(collegeMemberPO.getCollegeID())){
			for(String m1:collegeMemberPO.getMemberIDList()){
				if(m1.equals(teacherID)){
					return CollegeQueryRM.TEACHERID_EXIST;
				}
			}
			return CollegeQueryRM.SUCCESS;
		}
		return CollegeQueryRM.COLLEGE_NOT_EXIT;
	}

	@Override
	public CollegeQueryRM deleteTeacher(String collegeID, String teacherID) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public CollegeQueryRM addStudent(String collegeID, StudentPO po,
			String studentID) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public CollegeQueryRM deleteStudent(String collegeID, String studentID) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public CollegeQueryRM addCourse(String collegeID, String courseName,
			String courseID) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public CollegeQueryRM deleteCollegeConsular(String collegeID,
			String CollegeConsularID) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
